import render from 'src/hrpub/common/frame/render';
import MainAction from '../actions/main';
import HeaderAction from '../actions/headerAction';
import {createPage, base} from 'nc-lightapp-front';
import Header from '../components/Header';
import ListTable from '../components/ListTable';
import CardDetail from '../components/card';

const {NCTabs, NCAffix} = base;
import ApproveDetail from 'uap/common/components/ApproveDetail';
import ApprovalTrans from 'uap/common/components/approvalTrans';


import './index.less';
import {getAppPageConfig} from "../../../../hrpub/common/utils/utils";

const Homepage = render({
    actions: {
        mainAction: MainAction,
        headerAction: HeaderAction
    }
})(({props, action, state}) => {
    props.use.form(
        'overtime_card'
    )
    props.use.editTable(
        'overtime_list'
    )
    // props.use.search('head_query')
    const {mainAction, headerAction} = action
    const {myLeave} = props
    const {visibleList = []} = myLeave
    return (
        <div className="selfapp_myapply flex-container">
            <NCAffix>
                <Header {...props} />
            </NCAffix>
            <div className="table-content">
                <ListTable {...props} tableCode="overtime_list" type="overtime"/>
                <CardDetail json={myLeave.json} {...props} formCode="overtime_card"></CardDetail>
                {myLeave.showApproveDetail && <ApproveDetail
                    show={myLeave.showApproveDetail}
                    close={mainAction.closeApproveDetailDialog}
                    billtype={myLeave.billtype}
                    billid={myLeave.billId}/>}
                {myLeave.assignedDisplay ? <ApprovalTrans
                    title={myLeave.json['6040-000032']}/* 国际化处理： 指派*/
                    data={myLeave.assignedData}
                    display={myLeave.assignedDisplay}
                    getResult={headerAction.assignedBill}
                    cancel={headerAction.cancelAssigned}
                /> : ""}
            </div>
        </div>
    )
});

export default createPage({
    billinfo: [{
        billtype: 'form',
        pagecode: getAppPageConfig().appcode,
        headcode: 'overtime_card'
    }]
})(Homepage)